#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int removeDuplicates(int* nums, int numsSize)
{
    int count = 0;
    int i = 0;
    for (i = 0; i < numsSize - count; i++)
    {
        while (nums[i] == nums[i+1])
        {
            int begin = i + 1;
            while (begin < numsSize - count - 1)
            {
                nums[begin] = nums[begin + 1];
                begin++;
            }
            nums[begin] = ' ';
            count++;
        }
    }

    return numsSize - count;

}

int main()
{
    int nums[10] = { 0, 0, 0, 0, 0 };
    int ret = removeDuplicates(nums, 5);
    printf("%d\n", ret);
    int i = 0;
    for (i = 0; i < ret; i++)
    {
        printf("%d ", nums[i]);
    }

    return 0;
}

void merge(int* nums1, int nums1Size, int m, int* nums2, int nums2Size, int n)
{
    int src1 = m - 1;
    int src2 = n - 1;
    int dest = m + n - 1;
    while (src1 >= 0 && src2 >= 0)
    {
        if (nums2[src2] > nums1[src1])
        {
            nums1[dest--] = nums2[src2--];
        }
        else
        {
            nums1[dest--] = nums1[src1--];
        }
    }
    while (src2 >= 0)
    {
        nums1[dest--] = nums2[src2--];
    }

}
int main()
{
    int nums[10] = { 0, 0, 0, 0, 0 };
    int ret = removeDuplicates(nums, 5);
    printf("%d\n", ret);
    int i = 0;
    for (i = 0; i < ret; i++)
    {
        printf("%d ", nums[i]);
    }

    return 0;
}
